<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<div>系统将在<span id="box">10</span>秒后跳到百度首页</div>

<input type="button" value="停止" onclick="stops()" /> 

<input type="button" value="继续" onclick="ctn()" />

<script>
function stops()
{
	//停止时清除定时器
	clearInterval(T);
}
function ctn()
{
	//继续时继续执行定时器
	T = setInterval(down,1000);
	
}
function down()
{
	//获取span标签元素
	var box = document.getElementById('box');
	
	//让内容的值减一
	box.innerHTML --;
	
	//判断内容的值是否小于等于0
	if(box.innerHTML<=0)
	{
		//是则清除定时器，跳转到百度
		window.location.href = "http://baidu.com";
	}
}

//一开始执行定时器
var T = setInterval(down,1000);


</script>	
</body>
</html>
